package com.ysj.demo.accompanynetwork;

import android.app.Application;
import android.content.Context;
import android.util.Log;

import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushConfig;
import com.tencent.android.tpush.XGPushManager;

/**
 * Created by 80530 on 2018/8/14.
 */

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        XGPushConfig.enableDebug(this, true);
//        XGPushConfig.enableOtherPush(getApplicationContext(), true);
//        XGPushConfig.setHuaweiDebug(true);
//        XGPushConfig.setMiPushAppId(getApplicationContext(), "APPID");
//        XGPushConfig.setMiPushAppKey(getApplicationContext(), "APPKEY");
//        XGPushConfig.setMzPushAppId(this, "APPID");
//        XGPushConfig.setMzPushAppKey(this, "APPKEY");

        XGPushManager.registerPush(this, new XGIOperateCallback() {
            @Override
            public void onSuccess(Object data, int flag) {
                 //token在设备卸载重装的时候有可能会变
                Log.d("TPush", "注册成功，设备token为：" + data);
            }

            @Override
            public void onFail(Object data, int errCode, String msg) {
                Log.d("TPush", "注册失败，错误码：" + errCode + ",错误信息：" + msg);
            }
        });
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
    //    StubAppUtils.attachBaseContext(base);
    }
}
